import { CascaderOption } from 'antd-mobile/es/components/cascader-view';
export declare type RelItem = {
  value: number;
  label: string;
  ids: string[];
  sid: string;
  id: number;
  orderIndex?: number;
  name: string;
};
export declare type ValueLabel = { value: number; label: string };
export declare type StrTreeItemType = {
  value: string;
  label: string;
  children?: StrTreeItemType[];
};
export declare type IdName = { id: number; name: string };
export declare type TreeItemType = {
  value: number;
  label: string;
  ids: string[];
  children?: TreeItemType[];
};
export declare type Region = {
  value: number;
  label: string;
  ids: [];
  children?: TreeItemType[];
};
export declare type WorkFlow = {
  value: number;
  label: string;
  ids: [];
  children?: TreeItemType[];
};
export declare type LabeledEnum = { value: string; label: string };
export declare type WeiXinUser = {
  name: string;
  thumbAvatar: string;
  userid: string;
};
export declare type StandardNode = {
  orderIndex: number;
  name: string;
  percent: number;
  value: number;
  label: string;
  sid: string;
  ids: string[];
  money?: number;
  children: StandardNode[];
};
export declare type LivingType = {
  id: number;
  value: number;
  label: string;
  sid: string;
  ids: string[];
  standard: { name: string; label: string };
};
export declare type Living = {
  id: number;
  name: string;
  createdAt: string;
  updatedAt: string;
  start: string;
  creator: WeiXinUser;
  modifier: WeiXinUser;
  type: LivingType;
  leader?: WeiXinUser;
  remark: string;
  source: { id: number; fullName: string; name: string };
};
export declare type StaffLiving = {
  creator: WeiXinUser;
  modifier: WeiXinUser;
  createdAt: string;
  updatedAt: string;
  id: number;
  name: string;
  leader: WeiXinUser;
  type: {
    label: string;
    value: number;
    sid: string;
    standard: { name: string; label: string };
    ids: string[];
  };
  start: string;
  remark: string;
  pathPrefix: string;
};

export declare type ObsMaterial = {
  id: number;
  name: string;
  obsKey: string;
  createdAt: string;
  updatedAt: string;
  creator: WeiXinUser;
  modifier: WeiXinUser;
  remark: string;
  standardMeta: LabeledEnum;
  thumb: string;
  effectiveDate?: string;
};

declare type OADepartment = {
  ids: string[];
  label: string;
  name: string;
  orderIndex?: number;
  sid: string;
  value: number;
};

export declare type AuditNode = {
  creator: WeiXinUser;
  modifier: WeiXinUser;
  id: number;
  sid: string;
  orderIndex?: number;
  name: string;
  leader: WeiXinUser;
  ids: string[];
  grouped: boolean;
  level: string;
  createdAt: string;
  updatedAt: string;
  children?: AuditNode[];
} & CascaderOption;

export declare type AuditNodeStatus = {
  node: {
    creator: WeiXinUser;
    modifier: WeiXinUser;
    createdAt: string;
    updatedAt: string;
    id: number;
    name: string;
    orderIndex: number;
    leader: WeiXinUser;
    grouped: boolean;
    level: string;
    startNode: boolean;
    staffedNode: boolean;
    endNode: boolean;
  };
  lines: string[];
  last?: string;
  systemError: boolean;
  status: {
    launched?: number;
    incoming?: number;
    incomingAfterFeedback?: number;
    approved?: number;
    waitingForModification?: number;
    needYouModify?: number;
    modifyProvided?: number;
    incomeAfterModify?: number;
    remanded?: number;
    needYouRestart?: number;
    audited?: number;
    waitingForFeedback?: number;
    needYouFeedback?: number;
    feedbackProvided?: number;
  };
};

export declare type AuditNodeLiving = {
  creator: WeiXinUser;
  modifier: WeiXinUser;
  createdAt: string;
  updatedAt: string;
  id: number;
  name: string;
  leader: WeiXinUser;
  type: {
    label: string;
    value: number;
    sid: string;
    standard: {
      name: string;
      label: string;
      needHandle: boolean;
      // 11 -4
      // 12 -5
      launched: boolean;
      incoming: boolean;
      incomingAfterFeedback: boolean;
      approved: boolean;
      waitingForModification: boolean;
      needYouModify: boolean;
      modifyProvided: boolean;
      incomeAfterModify: boolean;
      remanded: boolean;
      needYouRestart: boolean;
      audited: boolean;
      waitingForFeedback: boolean;
      needYouFeedback: boolean;
      feedbackProvided: boolean;
      descendantsLock: boolean;
    };
    ids: string[];
  };
  start: string;
  remark: string;
  pathPrefix: string;
  children?: AuditNodeLiving[];
  label?: string;
  value?: string;
  source: {
    id: number;
    name: string;
    fullName: string;
    orderIndex?: number;
    grouped: boolean;
    originId: number;
  };
  round?: number;
};

export declare type TreedAuditNodeLiving = {
  node: {
    creator: WeiXinUser;
    modifier: WeiXinUser;
    createdAt: string;
    updatedAt: string;
    id: number;
    name: string;
    orderIndex: number;
    leader: WeiXinUser;
    grouped: boolean;
    level: string;
    startNode: boolean;
    staffedNode: boolean;
    endNode: boolean;
    staffNode: boolean;
  };
  livings: AuditNodeLiving[];
  children: TreedAuditNodeLiving[];
};

export declare type AuditStatusTip = {
  label: string;
  value: string;
  color: string;
};

export declare type Liaison = {
  id: number;
  name: string;
  createdAt: string;
  updatedAt: string;
  phone: string;
  canViewPhone: boolean;
  departmental: string;
  position: string;
  creator: WeiXinUser;
  modifier: WeiXinUser;
  remark: string;
};

export declare type Customer = {
  id: number;
  name: string;
  createdAt: string;
  updatedAt: string;
  address: string;
  phone: string;
  creditCode: string;
  firstContact: string;
  creator: WeiXinUser;
  modifier: WeiXinUser;
  remark: string;
  region?: Region;
  type: {
    label: string;
    name: string;
    sid: string;
    orderIndex?: number;
    ids: string[];
  };
  bankAccounts: {
    id: string;
    name: string;
    no: string;
    accountNumber: string;
    label: string;
  }[];
  invoiceApplies: {
    id: number;
    code: string;
    money: number;
    leader: WeiXinUser;
    type: { id: number; label: string };
  }[];
  invoiceApplyItemMoneySum: number;
};

export declare type Paid = {
  id: number;
  date: string;
  payee: WeiXinUser;
  creator: WeiXinUser;
  money: number;
  remark: string;
  label: string;
  value: number;
  sid: string;
};

export declare type Block = {
  id: number;
  parentId?: number;
  code?: string;
  remark?: string;
  name: string;
  fullName: string;
  paidOnSingle: number;
  sporadic: boolean;
  /**
   * 对零散测量项目，不用money，用单项工程汇总金额
   */
  childrenSum: number;
  money: number;
  level: 'project' | 'single' | 'departmental' | 'supplier';
  createdAt: string;
  leader: WeiXinUser;
  creator: WeiXinUser;
  remainder: number;
  region?: Region;
  updatedAt: string;
  childrenCount: number;
  children: Block[];
  livings: Living[];
  payWay?: LabeledEnum;
  signMoneyStatus?: LabeledEnum;
  incomeWay?: LabeledEnum;
  customer?: {
    ids: string[];
    label: string;
    name: string;
    sid: string;
    value: number;
    id: number;
    address: string;
    phone: string;
    creditCode: string;
  };
  opportunity: {
    ids: string[];
    label: string;
    name: string;
    sid: string;
    value: number;
  };
  payPlanRemainder: number;
  unPaid: number;
  unInvoice: number;
  paids: Block[];
  invoices: Block[];
  stage: LabeledEnum;
  payPlans?: Block[];
  totalPaid: number;
  paidPercent: number;
  latestPaid: Paid;
  standardNode?: StandardNode;
  type?: {
    ids: string[];
    label: string;
    name: string;
    sid: string;
    value: number;
  };
  bizOADepartment: RelItem;
  oaCompany?: RelItem;
  oaDepartment: RelItem;
  paidDate?: string;

  costStats?: {
    total: number;
    opporutnityNotMirgate: number;
    allocated: number;
    natived: number;
  };
  reimbMixItems: ReimbMixItem[];
  signedDate?: string;
  signedDateLivingId?: number;

  adopt?: number;
  adoptRatio?: number;
  adoptRemark?: string;

  freeRange?: number;
  freeRangeRatio?: number;
  freeRangeRemark?: string;

  totalPercent?: number;
  invoiceApplies: {
    id: number;
    code: string;
    money: number;
    leader: WeiXinUser;
    type: { id: number; label: string };
  }[];
  invoiceApplyItemMoneySum: number;
  invoiceUnPaid: number;
  // 预算
  budget?: number;
  budgetId?: number;
  paidIsTouchSingleBlock: boolean;
};

export declare type Opportunity = {
  id: number;
  name: string;
  remark: string;
  money: number;
  createdAt: string;
  updatedAt: string;
  region: Region;
  leader: WeiXinUser;
  creator: WeiXinUser;
  techSupport?: WeiXinUser;
  bizOrigin?: WeiXinUser;
  types: TreeItemType[];
  standardNodes: TreeItemType[];
  livings: Living[];
  // 2024-12-25 为了能更新客户，直接将整个partake返回来了！
  partakeCustomers: {
    id: number;
    creator: WeiXinUser;
    modifier: WeiXinUser;
    createdAt: string;
    updatedAt: string;
    other: {
      label: string;
      name: string;
      value: string;
      sid: string;
      ids: string[];
      address: string;
      phone: string;
      creditCode: string;
    };
  }[];
  customers: TreeItemType[];
  liaisons: TreeItemType[];
  blocks: TreeItemType[];
  paidRewards: {
    code: string;
    id: number;
    money: number;
    leader: WeiXinUser;
    commission: number;
  }[];
  partakingTypes: {
    id: number;
    other: {
      label: string;
      name: string;
      id: number;
      sid: string;
      ids: string[];
      value: number;
    };
  }[];
  costStats?: {
    total: number;
    hasBeenMigrated: number;
    natived: number;
    anticipated: number;
  };
  reimbMixItems: ReimbMixItem[];
  // 预算
  budget?: number;
  budgetId?: number;
  paidBlocks: {
    id: number;
    money: number;
    paidDate: string;
    level: string;
    leader: WeiXinUser;
    stage?: { label: string; value: string };
    paidReward?: {
      id: number;
      code: string;
      leader: WeiXinUser;
      level: string;
    };
  }[];
  staffLivingPercent: number;
  fullStaffLivingPercent: boolean;
};

export declare type OASystem = {
  id: number;
  name: string;
  performanceChartPeriod: LabeledEnum;
  paidChartPeriod: LabeledEnum;
  performancePayStage?: { label: string; id: number };
  paidRewardPayStage?: { label: string; id: number };
  canUseInvoicePocket: boolean;
};

export declare type PageInfo = {
  code: number;
  msg: string;
  page: number;
  size: number;
  totalElements: number;
  totalPages: number;
  last: boolean;
};
export declare type PageResult<T> = {
  data?: T[];
} & PageInfo;

export declare type DetailResult<T> = {
  data?: T;
  code: number;
  msg: string;
};

export declare type BizType = {
  idss: string[];
  label: string;
  value: number;
  sid: string;
  name: string;
};
export declare type ReimbRaw = {
  label: string;
  name: string;
  value: number;
  id: number;
  applicant: WeiXinUser;
  sid: string;
  code: string;
  finType: { value: string; label: string };
  money: number;
  blockName?: string;
  blockId?: number;
  opportunityName?: string;
  opportunityId?: number;
  isAnticipated: boolean;
  isHistory: string;
  isOpportunity: boolean;
  isSpecialized: boolean;
  specializedId: number;
  isBlock: boolean;
  ids: string[];
};
export declare type Reimb = {
  paidForAnticipatedReimb?: {
    code: string;
    money: string;
    label: string;
    id: number;
  };
  childrenOfPays: { code: string; money: string; label: string; id: number }[];
  anyItmeInvoiceFromOtherItem: boolean;
  anyItemDontNeedInvoice: boolean;
  history?: boolean;
  anticipated: boolean;
  historyDate?: string;
  myCreateOrApply?: boolean;
  ancestorId?: number;
  id: number;
  money: number;
  name: string;
  applicant: WeiXinUser;
  creator: WeiXinUser;
  createdAt: string;
  updatedAt: string;
  remark: string;
  code?: string;
  children: Reimb[];
  bizType?: BizType;
  finType?: { label: string; value: string };
  level: { label: string; value: string };
  oaCompany?: {
    ids: string[];
    label: string;
    name: string;
    value: number;
    sid: string;
    leader?: WeiXinUser;
  };
  oaDepartment: OADepartment;
  onlyBlock?: {
    code?: string;
    ids: string[];
    label: string;
    name: string;
    money: number;
    leader?: WeiXinUser;
    sid: string;
    value: number;
  };

  block?: {
    code?: string;
    ids: string[];
    label: string;
    name: string;
    money: number;
    leader?: WeiXinUser;
    sid: string;
    value: number;
  };
  onlyOpportunity?: {
    ids: string[];
    label: string;
    name: string;
    money: number;
    leader?: WeiXinUser;
    sid: string;
    value: number;
  };
  oppportunity?: {
    ids: string[];
    label: string;
    name: string;
    money: number;
    leader?: WeiXinUser;
    sid: string;
    value: number;
  };
  specialized?: {
    yearly: number;
    ids: string[];
    label: string;
    name: string;
    money: number;
    leader?: WeiXinUser;
    sid: string;
    value: number;
  };
  subject?: {
    ids: string[];
    label: string;
    name: string;
    sid: string;
    value: number;
  };

  // 分摊情况：
  migratedTo?: { id: number; name: number; code: string };
  migratedFrom?: { id: number; name: number; code: string };

  haveBeenWriteOff: number;
  waitingWriteOff: number;
  writeOff: number;
  reimbMoney: number;
  paidMoney: number;
  refundMoney: number;
  actPaidMoey: number;
  unPaidMoney: number;
  actWaitingWriteOff: number;

  // 新明细，24-05-27
  items: {
    id: number;
    creator: WeiXinUser;
    money: number;
    subject?: {
      isAllocated: boolean;
      isAnticipated: boolean;
      isSpecialized: boolean;
      label: string;
      name: string;
      value: number;
      id: number;
      sid: string;
      ids: string[];
    };
    // 2024-11-19 新增预算明细
    budgetItem?: {
      id: number;
      apply: { id: number };
      createdAt: string;
      creator: WeiXinUser;
      modifier: WeiXinUser;
      money: number;
      remark: string;
      statusCompareWithPrevious: string;
      subject: {
        label: string;
        name: string;
        value: number;
        id: number;
        sid: string;
        ids: string[];
        isAllocated: boolean;
        isAnticipated: boolean;
        isSpecialized: boolean;
      };
    };
    block?: {
      id: number;
      label: string;
      leader: WeiXinUser;
      ids: string[];
      level: string;
      money: number;
    };
    //status?: { label: string; value: string };
    invoiceStatus: { label: string; value: string };
    //lackInvoice?: boolean;

    invoicePocket?: {
      id: number;
      ids: string[];
      label: string;
      name: string;
      value: number;
      useRange: { label: string; value: string };
    };
    remark: string;
  }[];
  useInvoicePocket: boolean;
  paid: boolean;
  isWaittingMeToWriteOff: boolean;
  waitingSupplementInvoice: boolean;

  invoiceSupplementCompleted: boolean;
  supplier?: { id: number; name: string };
  bank?: { accountNumber: string; bank: string };
};

export declare type WaitingWriteOffApply = {
  apply: ReimbRaw;
  total: number;
  haveDoneWriteOff: number;
  remainder: number;
};

export declare type StaffWaitingWriteOff = {
  applicant: WeiXinUser;
  total: number;
  waitingWriteOffApplys: WaitingWriteOffApply[];
};

export declare type Supplier = {
  id: number;
  name: string;
  useRange?: { label: string; value: string };
  createdAt: string;
  updatedAt: string;
  creator: WeiXinUser;
  creditCode?: string;
  address?: string;
  level: { value: string; label: string };
  type?: {
    label: string;
    name: string;
    value: number;
    sid: string;
    orderIndex?: number;
    ids: string[];
  };
  remark: string;
  bank?: string;
  bankNo?: string;
  accountNumber?: string;
  children: Supplier[];
};

export declare type InvoicePocket = {
  overdraft: number;
  remark: string;
  leader: WeiXinUser;
  id: number;
  name: string;
  orderIndex?: number;
  creator: WeiXinUser;
  modifier: WeiXinUser;
  createdAt: string;
  updatedAt: string;
  useRange: { label: string; value: string };
  money: number;
  used: number;
  remainder: number;
  auditedMoney: number;
  unauditedMoney: number;
  invoices: Invoice[];
  // 被锁定，不再允许使用日期
  lockDate?: string;
};

export declare type Invoice = {
  id: number;
  name: string;
  money: number;
  pathPrefix: string;
  remark: string;
  code: string;
  valid: boolean;

  type: { id: number; label: string; value: string };
  pocket: {
    id: number;
    name: string;
    useRange: { label: string; value: string };
  };
  creator: WeiXinUser;
  createdAt: string;
  issuedDate?: string;
  accountSubject?: { id: number; name: string; label: string };
  oaCompany?: {
    label: string;
    value: number;
    sid: string;
    ids: string[];
    name: string;
  };
  pocketLockedDate?: string;
  voucher?: {
    id: number;
    label: string;
    value: number;
    sid: string;
    ids: string[];
    name: string;
    code: string;
    accountSubject?: { id: number; name: string; label: string };
  };
};

export declare type ReimbMixItem = {
  apply: {
    code: string;
    finType: { label: string; value: string };
    id: number;
    ids: string[];
    sid: string;
    label: string;
    level: { label: string; value: string };
    money: number;
    name: string;
    value: number;
  };
  creator: WeiXinUser;
  createdAt: string;
  id: number;
  lackInvoice: boolean;
  money: number;
  remark: string;
  subject: {
    id: number;
    sid: string;
    ids: string[];
    label: string;
    name: string;
    value: number;
  };
  block?: {
    id: number;
    ids: string[];
    sid: string;
    label: string;
    name: string;
  };
  opportunity?: {
    id: number;
    ids: string[];
    sid: string;
    label: string;
    name: string;
  };
};

export declare type ReimbStatistics = {
  money: number;
  byObjectKinds: any[];
  byStaffs: any[];
  bySubjects: any[];
  byYearMonths: any[];
  items: ReimbMixItem[];
};

// 2025-08-23 后端变了，用一个新的类名代码这个
export declare type OAUser = {
  avatar: string;
  id: string;
  name: string;
  oaSystemLivings: {
    creator: WeiXinUser;
    createdAt: string;
    id: string;
    leader: WeiXinUser;
    modifier: WeiXinUser;
    name: string;
    pathPrefix: string;
    remark: string;
    type: {
      ids: string[];
      sid: string;
      value: number;
      label: string;
      standard: { label: string; name: string };
    };
  }[];
};

export declare type ComplexOAUser = {
  avatar: string;
  id: string;
  name: string;
  oaSystemLivings: {
    creator: WeiXinUser;
    createdAt: string;
    id: string;
    leader: WeiXinUser;
    modifier: WeiXinUser;
    name: string;
    pathPrefix: string;
    remark: string;
    type: {
      ids: string[];
      sid: string;
      value: number;
      label: string;
      standard: { label: string; name: string };
    };
  }[];
  diagnosisGroups: { id: number; name: string; departmentId: number; label: string; price: number; value: number; }[]
  projectManager: boolean;
  manageHospitals: { id: number; name: string }[],
  doctor?: { id: number; name: string, code: string }

}


export declare type PayStageRaw = {
  name: string;
  id: number;
  sid: string;
  label: string;
  ids: string[];
  first: string;
  last: string;
};

export declare type PerformanceRaw = {
  label: string;
  name: string;
  value: number;
  money?: number;
  sid: string;
  ids: string[];
  code: string;
  level: string;
  cost?: number;
  commissionRatio: number;
  commission: number;
  percent?: number;
  leader: WeiXinUser;
  commissionRatioType: {
    fixed: boolean;
    label: string;
    maxRatio: number;
    minRatio: number;
    value: number;
  };
  payStage?: PayStageRaw;
  isPayApply: boolean;
  scoring: SimpleScoring;
};

export declare type PerformanceItem = {
  leader: WeiXinUser;
  label: string;
  name: string;
  value: number;
  id: number;
  level: string;
  money: number;
  code?: string;
  percent: number;
  role: string;

  apply: {
    id: number;
    code: string;
    commission: number;
    commissionRatio: number;
    cost: number;
    getMoney: number;
    level: 'root' | 'payApply';
    locked: number;
    value: number;
  };

  block: {
    label: string;
    money: number;
    ids: string[];
    id: number;
    leader: WeiXinUser;
    oaDepartment?: {
      label: string;
      name: string;
      value: number;
      id: number;
      sid: string;
      leader: WeiXinUser;
    };
    supplier?: {
      label: string;
      name: string;
      value: number;
      id: number;
      sid: string;
      leader: WeiXinUser;
    };
  };
};

export declare type Performance = {
  canEdit: boolean;
  locked: boolean;
  children: PerformanceRaw[];

  parent?: PerformanceRaw;
  pathPrefix: string;
  remark: string;
  code: string;
  money?: number;
  percent?: number;

  block: {
    label: string;
    code?: string;
    money: number;
    id: number;
    ids: string[];
  };
  leader: WeiXinUser;
  id: number;
  name: string;
  level: string;
  payStage?: PayStageRaw;
  mayUsepayStage?: PayStageRaw;

  orderIndex?: number;
  creator: WeiXinUser;
  modifier: WeiXinUser;
  createdAt: string;
  updatedAt: string;

  commissionRatioType: {
    fixed: boolean;
    label: string;
    maxRatio: number;
    minRatio: number;
    value: number;
  };
  commissionRatio?: number;
  commission?: number;
  adjust: number;
  cost?: number;
  anticipatedReimbs: {
    code: string;
    money: number;
    isAnticipated: boolean;
    isBlock: boolean;
    id: number;
    name: string;
  }[];
  anticipatedCost?: number;
  items: { item: PerformanceItem; money: number }[];

  /**
   * 对应的项目节点
   */
  livings: { blockLiving: BlockLivingRaw; percent: number }[];
  realTimeParams: {
    money: number;
    cost: number;
    anticipatedCost: number;
    percent: number;
    ratio: number;
    commission: number;
  };
  isPayApply: boolean;
  doneScore: boolean;
  canDoScore: boolean;
  canDoAnticipatedReimb: boolean;

  score?: number;
  scoreLevel: string;

  typedScores: {
    type: {
      value: number;
      id: number;
      label: string;
      name: string;
      maximum: number;
      minimum: number;
      remark: string;
    };
    children: {
      value: number;
      id: number;
      label: string;
      name: string;
      remark: string;
      maximum: number;
      minimum: number;
    }[];

    myStaffLivings: {
      leader: WeiXinUser;
      weight: number;
      id: number;
      type: {
        value: number;
        sid: string;
        ids: string[];
        label: string;
        standard: { name: string; label: string };
      };
    }[];
    items: {
      id: number;
      score?: string;
      remark?: string;
      createdAt: string;
      updatedAt: string;
      type?: { name: string };
      // item: {
      //   id: number,
      //   score: string,
      //   remark: string,
      //   createdAt: string,
      //   updatedAt: string
      //   type:{ name:string }
      // };
      staffLiving: {
        leader: WeiXinUser;
        weight: number;
        id: number;
        type: {
          value: number;
          sid: string;
          ids: string[];
          label: string;
          standard: { name: string; label: string };
        };
      };
    }[];
  }[];
};

declare type BlockLivingRaw = {
  creator: string;
  modifier: string;
  createdAt: string;
  updatedAt: string;
  id: number;
  name: string;
  leader: WeiXinUser;
  source: { id: number; name: string; fullName: string };
  type: {
    label: string;
    value: string;
    sid: string;
    standard: { name: string; label: string };
    ids: string[];
  };
  start: string;
  remark: string;
  standardNode: {
    label: string;
    name: string;
    value: number;
    id: number;
    sid: string;
    orderIndex?: number;
    percent: number;
    ids: string[];
  };
};

export declare type PerformanceTimeLine = {
  performance: PerformanceRaw;
  nbp: {
    node: { id: number; label: string; name: string };
    blockLiving?: BlockLivingRaw;
    performance?: PerformanceRaw;
    canApplyPay?: boolean;
    inApplyPay?: boolean;
  }[];
};

export declare type BlockPerformanceStep = {
  timeLines: PerformanceTimeLine[];
  canApplyPayBlockLivings: BlockLivingRaw[];
  canApplyPayPercent: number;
  inApplyPayBlockLivings: BlockLivingRaw[];
  inApplyPayPercent: number;
};

export declare type Specialized = {
  id: number;
  name: string;
  yearly: number;
  leader: WeiXinUser;
  oaDepartment: {
    value: number;
    label: string;
    name: string;
    sid: string;
    ids: string[];
  };
};

export declare type LastUpdate = {
  updatedAt: string;
  author: WeiXinUser;
  remark: string;
  onlyCreated: boolean;
};

export declare type InvoiceApply = {
  id: number;
  name: string;
  leader: WeiXinUser;
  code: string;
  oaDepartment: {
    value: number;
    label: string;
    name: string;
    sid: string;
    ids: string[];
  };

  oaCompany: {
    value: number;
    label: string;
    name: string;
    sid: string;
    ids: string[];
  };
  block: {
    value: number;
    label: string;
    name: string;
    sid: string;
    id: number;
    ids: string[];
  };
  type: {
    label: string;
    value: string;
    sid: string;
    ids: string[];
  };
  money: number;
  remark: string;
  content: string;
  customer: {
    value: number;
    label: string;
    name: string;
    sid: string;
    id: number;
    ids: string[];
    creditCode: string;
  };
  address: string;
  phone: string;
  bankName: string;
  accountNumber: string;
  liaison?: {
    value: number;
    label: string;
    name: string;
    sid: string;
    ids: string[];
  };
  creator: WeiXinUser;
  modifier: WeiXinUser;
  createdAt: string;
  updatedAt: string;
  items: {
    id: number;
    creator: WeiXinUser;
    modifier: WeiXinUser;
    createdAt: string;
    updatedAt: string;
    remark: string;
    money: number;
    tax: number;
    ratio: number;
    content: string;
    no: string;
  }[];
};

export declare type Budget = {
  id: number;
  code: string;
  name: string;
  creator: WeiXinUser;
  modifier: WeiXinUser;
  createdAt: string;
  updatedAt: string;
  money: number;
  used: number;
  remainder: number;
  pathPrefix: string;
  remark: string;
  parentId?: number;
  block?: {
    money: number;
    name: string;
    id: string;
    label: string;
    value: string;
  };
  specialized?: {
    yearly: number;
    ids: string[];
    label: string;
    name: string;
    money: number;
    leader?: WeiXinUser;
    sid: string;
    value: number;
  };
  opportunity?: {
    money: number;
    name: string;
    id: string;
    label: string;
    value: string;
  };
  orderIndex?: number;
  descendants: {
    code: string;
    money: number;
    id: number;
    name: string;
    label: string;
  }[];
  items: {
    origin: {
      id: number;
      apply: { id: number; label: string };
      subject: { id: number; label: string };
      money: number;
      statusCompareWithPrevious: string;
      remark: string;
      pathPrefix: string;
    };
    used: number;
    remainder: number;
  }[];
  // 2025-6-12日，增加一级预算统计
  sbjectStats: {
    subject: {
      id: number;
      name: string;
      label: string;
      sid: string;
      ids: string[];
    };
    money: number;
    used: number;
    remainder: number;
  }[];
};

declare type SimpleScoring = {
  code: string;
  id: number;
  ids: string[];
  label: string;
  name: string;
  orderIndex?: string;
  value: string;
};

export declare type Scoring = {
  id: number;
  code: string;
  performance?: {
    id: number;
    code: string;
  };
  // 最终得份
  score?: number;
  block: {
    code: string;
    id: number;
    ids: string[];
    label: string;
    leader: WeiXinUser;
    level: string;
    money: number;
    sid: string;
    value: number;
  };
  createdAt: string;
  creator: WeiXinUser;
  items: any[];
  leader: WeiXinUser;
  modifier: WeiXinUser;
  name: string;
  orderIndex?: number;
  pathPrefix: string;
  updatedAt: string;
  // scoreMaps: {
  //   id: number;
  //   name: string;
  //   remark: string;
  //   selectors: {
  //     id: number;
  //     name: string;
  //     remark: string;
  //     maximum: number;
  //     minimum: number;
  //     items: {
  //       id?: number;
  //       score?: string;
  //       remark?: string;
  //       createdAt?: string;
  //       updatedAt?: string;
  //       editAble: false;
  //       living: {
  //         leader: WeiXinUser;
  //         weight: number;
  //         id: number;
  //         type: {
  //           value: number;
  //           sid: string;
  //           ids: string[];
  //           label: string;
  //           standard: { name: string; label: string };
  //         };
  //       };
  //     }[];
  //   }[];
  // }[];
  typedScores: {
    type: {
      value: number;
      id: number;
      label: string;
      name: string;
      maximum: number;
      minimum: number;
      remark: string;
    };
    children: {
      value: number;
      id: number;
      label: string;
      name: string;
      remark: string;
      maximum: number;
      minimum: number;
    }[];

    myStaffLivings: {
      leader: WeiXinUser;
      weight: number;
      id: number;
      type: {
        value: number;
        sid: string;
        ids: string[];
        label: string;
        standard: { name: string; label: string };
      };
    }[];
    items: {
      item: {
        id: number;
        score: string;
        remark: string;
        createdAt: string;
        updatedAt: string;
        type: { name: string };
      };
      staffLiving: {
        leader: WeiXinUser;
        weight: number;
        id: number;
        type: {
          value: number;
          sid: string;
          ids: string[];
          label: string;
          standard: { name: string; label: string };
        };
      };
    }[];
  }[];
};

export declare type PaidSignStatistics = {
  sign: number;
  paid: number;
  leaders: {
    leader: WeiXinUser;
    paid: number;
    sign: number;
    paidItems: {
      m: number;
      opportunity: {
        id: number;
        ids: string[];
        label: string;
        leader: WeiXinUser;
        money: number;
        name: string;
      };
    }[];
    signItems: {
      m: number;
      opportunity: {
        id: number;
        ids: string[];
        label: string;
        leader: WeiXinUser;
        money: number;
        name: string;
      };
    }[];
  }[];
};
export declare type PaidRewardItem = {
  leader: WeiXinUser;
  id: number;
  ids: string[];
  label: string;
  livingId: number;
  money: number;
  name: string;
  percent: number;
  role: string;
  sid: string;
  value: number;
};

export declare type PaidRewardRaw = {
  id: number;
  code: string;
  commission: number;
  contribution: number;
  ids: string[];
  label: string;
  leader: WeiXinUser;
  level: string;
  name: string;
  orderIndex?: number;
  paid: number;
  paidDate: number;
  sid: string;
  value: number;
  stage?: { name: string; label: string };
};

export declare type PaidReward = {
  id: number;
  level: string;
  code: string;
  name: string;
  creator: WeiXinUser;
  createdAt: string;
  leader: WeiXinUser;
  updatedAt: string;
  remark: string;
  opportunity: { label: string; id: number };
  paidBlock: {
    label: string;
    id: number;
    money: number;
    paidDate: string;
    stage: { label: string; value: string };
  };
  paid: number;
  cost: number;
  anticipatedCost: number;
  totalPaid: number;
  totalCommission: number;
  contribution: number;
  commission: number;
  commissionRatio: number;
  items: PaidRewardItem[];
  payStage?: PayStageRaw;
  mayUsePayStageWhenLock?: PayStageRaw;
};

export declare type Subject = {
  id: number;
  name: string;
  fullName: string;
  reimbItemCount: number;
  creator: WeiXinUser;
  childrenCount: number;
  modifier: WeiXinUser;
  createdAt: string;
  allocated: boolean;
  anticipated: boolean;
  onlyForBlock: boolean;
  onlyForOpportunity: boolean;
  specialized: boolean;
  subjects: {
    name: string;
    value: number;
    sid: string;
    ids: string[];
    isAllocated: boolean;
    isAnticipated: boolean;
    isSpecialized: boolean;
  }[];
  accountSubjects: { label: string; id: number; sid: number; value: number }[];
};

export declare type AccountSubject = {
  id: number;
  name: string;
};

export declare type OACompany = {
  id: number;
  name: string;
  personal: boolean;
};

export declare type Device = {
  id: number;
  serialNumber: string;
  name: string;

  code: string;
};

export declare type DeviceNeedRegister = {
  id: number;
  deviceSerialNumber: string;
  uid: string;
  requestCount: number;
  registrant?: string;
  registrantName?: string;
  registerDomain?: string;
  registerTime?: string;
  meta: string;
  ecgRemote: string;
  createdAt: string;
  updatedAt: string;
};

export declare type ConnectResult = {
  device: {
    id: number;
    serialNumber: string;
    clinicalDepartment: { id: number; name: string };
  };
  doctors: { id: number; name: string; uid: string }[];
  token: string;
};

export declare type RawDiagnosisGroup = {
  departmentId?: number;
  id: number;
  name: number;
  leader: WeiXinUser;
  price: number;
};

export declare type RawClinicalDepartment = {
  id: number;
  label: string;
  name: string;
  diagnosisGroup: RawDiagnosisGroup;
};
export declare type RawDevice = {
  code: number;
  dataFileType: string;
  id: number;
  serialNumber: number;
};

export declare type RawDoctor = {
  id: number;
  name: string;
  uid: string;
  label: string;
};
export declare type RawEcgParam = {
  param: { haveRangeAdjust: boolean, label: boolean, raw: boolean, unit: string, value: string };
  value: number;
  description?: string;
  status?: { label: string, value: 'normal' | 'elevated' | 'reduced' };
  configId?: number;
  rangeMax?: number;
  rangeMin?: number;
};

export declare type RawStudyLiving = {
  createdAt: string;
  criticalDescription?: string;
  criticalLevel?: { label: string, value: string };
  fileNames: string[];
  id: number;
  impression: string;
  name: string;
  pathPrefix: string;
  remark: string;
  start: string;
  autoAnalysisResult?: string;
  testResultStatus?: { label: string, value: string };
  type: {
    label: string;
    id: number;
    standard: { label: string; name: string };
  };
  updatedAt: string;
  doctor: RawDoctor;
  leader?: WeiXinUser;

};
export declare type RawHospital = {
  label: string;
  name: string;
  value: number;
  sid: string;
  uid: string;
}

export declare type RawAgeGroup = {
  defaultConfig: boolean;
  id: number;
  label: string;
  name: string;
  maxAge: number;
  minAge: number;
  minAgeUnit: { label: string, value: string };
  maxAgeUnit: { label: string, value: string };
  orderIndex?: number;
  zipAgeMax: number;
  zipAgeMin: number;

}

export declare type VerticalLine = {
  type: { label: string, value: string }, position: number
}



// 重组后的wage,直接来源于自己的后端
export declare type EcgXWave = {
  AIPn: number;
  autoAnalysisResult: string;
  haveParams?: boolean,
  zipWaveData: string;
  QRSList: { type: number, QQ: number, TT: number; SS: number }[],
  avrWave: { leadName: string, values: number[] }[],
  ecgParams: { name: string, value: number }[];
  leadsMaxMin: { leadName: string, max: number; min: number }[],
  verticalLines: VerticalLine[]
}

export declare type RawEcgParamAgeCfg = {
  id: number,
  name: string,
  label: string,
  sexTip: string,
  sexRange: string;
  valMax: number,
  valMin: number;
  param: { haveRangeAdjust: boolean, label: string, unit: string, value: string },
  sex?: { value: string, label: string }
}

export declare type Study = {
  uuid: string,
  zipAge: number;
  ageItems: [{ unit: { value: string, label: string }, value: string }];
  ageGroup: RawAgeGroup,
  created: RawStudyLiving,

  age: number;
  ageUnit: { label: string, value: string };
  clinicalDepartment: RawClinicalDepartment;
  hospital: RawHospital;
  code: string;
  createdAt: string;
  device: RawDevice;
  diagnosisGroup: RawDiagnosisGroup;
  doctor?: RawDoctor;
  ecgParams: RawEcgParam[];
  verticalLines: VerticalLine[];
  ecgType: { label: string, value: string };
  fileNames: string[];
  id: number;
  idCardNo: number;
  idCardType: { label: string, value: string };
  name: string;
  pathPrefix: string;
  price: number;
  sex: { label: string, value: string };
  uid: string;
  updatedAt: string;
  workingMode: { label: string, value: string };
  livingOfImageAcquisition: RawStudyLiving;
  livingOfPreliminaryDiagnosis: RawStudyLiving;
  livingOfRegistered: RawStudyLiving;
  livingOfDiagnosing?: RawStudyLiving;
  livingOfDiagnosed?: RawStudyLiving;

  livingOfAuditing?: RawStudyLiving;
  livingOfAudited?: RawStudyLiving;
  lastLiving: { standard: { value: string, label: string }, start: string },
  otherLivings: RawStudyLiving[];
  currentUserCanDoDiagnosis: boolean;
  currentUserCanDoAudit: boolean,
  livingOfCurrentDoing?: RawStudyLiving,
  ecgParamAgeCfgs: RawEcgParamAgeCfg[];
  livingOfLastImpression: {
    createdAt: string
    id: number;
    updatedAt: string;
    criticalDescription: string;
    criticalLevel: { value: string, label: string };
    ecgParams: RawEcgParam[];
    fileNames: string[];
    impression: string,
    name: string,
    pathPrefix: string,
    remark: string,
    start: string,
    testResultStatus: { value: string, label: string },
    type: { id: number, standard: { name: string, label: string } },
  };
  wave?: EcgXWave,
  // 诊断相关
  criticalDescription?: string;
  criticalLevel?: { value: string, label: string };
  testResultStatus?: { value: string, label: string };
  autoAnalysisResult?: string;
  impression?: string;
  reportFileName?: string;
};

export declare type NextStudy = {
  id: number;
  name: string;
  age: number;
  ageUnit: { value: string; label: string };
  sex: { value: string; label: string };
  currentUserCanDoDiagnosis: boolean;
  currentUserCanDoAudit: boolean;
  autoAnalysisResult?: string;
  impression?: string
  ecgParams: RawEcgParam[]
}

export declare type PreviewReprot = {
  livingId: number;
  uid: string;
  fileName: string;
  testResultStatus: { value: string, label: string }
  criticalLevel?: { value: string, label: string }
  criticalDescription?: string;
  impression: string;
  currentUserCanDoDiagnosis: boolean;
  currentUserCanDoAudit: boolean
}

export declare type PrintParam = {
  dataOffset: number;
  speedIndex: number;
  gainIndex: number;
  zoomLevel: number;
  horizontalTranslate: number;
  verticalTranslate: number;
  devicePixelRatio: number;
}

export declare type AfterDiagnosisOrAudit = {
  currentAction: string;
  current: {
    id: number;
    reportFileName: string;
    uid: string;
    impression: string;
  };
  next?: NextStudyAfterHandle
}

export declare type StudySearchStatsXTagCount = {
  leader?: WeiXinUser;
  userPerspective: string;
  wrapper: {
    clinicalDepartments?: { id: number; name: string }[];
    hospitals?: { id: number; name: string }[];
    grp1?: { id: number; name: string }[];
    grp2?: { id: number; name: string }[];
    doctor?: { id: number; name: string; code: string };
    projectManager: boolean;
  };
  countItems: {
    tab: { label: string; value: string };
    count: number;
    color: string;
  }[];
}

export declare type NextStudyAfterHandle = {
  age: number;
  code: string;
  ageUnit: { value: string; label: string }
  id: number;
  name: string;
  autoAnalysisResult?: string;
  criticalDescription?: string;
  criticalLevel: { value: string; label: string },
  testResultStatus?: { value: string; label: string },
  impression: string;
  ecgParams: RawEcgParam[],
  workingMode: { value: string; label: string };
  lastLiving: { standard: { value: string, label: string }, start: string },
}

export declare type QRSAnaResponse = {
  ecgParams: RawEcgParam[],
  autoAnalysisResult: string;
  AIPn: number;
}

export declare type TermGroup = {
  id: number; index: number; key: string; name: string,
  terms: string[]
};

export declare type EcgComplexTerm = {
  ecgCharacteristics: TermGroup[];
  ecgResult: TermGroup[];
  ecgWJZ: TermGroup[];
}

/**
 * 前端
 */
export declare type EcgWave = {

  AvrWave: {
    LeadName: string;
    Values: number[]
  }[],

  EcgAnaParams: {

    AIPn: string;
    AIResult: string;
    AIResultType: string;

    Axis: number;

    HR: number;

    PAxis: number;

    PP: number;

    PR: number;

    PsP1: number;
    PsP2: number;
    PsPP: number;
    PsQQ: number;
    PsRR: number;
    PsSS: number;
    PsT1: number;
    PsT2: number;
    PsTT: number;

    Qrs: number;
    Qt: number;
    Qtc: number;
    RV1: string;
    RV5: string;
    SV1: string;
    SV5: number;
    TAxis: number;
    TT: number;
  };
  LeadMaxMin: {
    LeadName: string;
    Max: number;
    Min: number;
  }[]

  QrsList: {
    // Q点发生时间
    QQ: number;
    // 发时间
    SS: number;
    // 生成时间
    TT: number;
    // 判断类型
    Type: number;
  }[];
  Wave: string
}



export interface EcgData {
  /** 文件标志 */
  tag: string,
  /** 水平分辨率 点/秒*/
  resH: number,
  /** 垂直分辨率 点/mv*/
  resV: number,
  /** 滤波器信息 */
  filter: string,
  /** 心电类型
   * 0=VECG : I II III X Y Z
   * 1=ECG12 : 12
   * 2=ECG15 : 12 + V7 V8 V9
   * 3=ECG18 : 12 + V7 V8 V9 V3R V4R V5R
   * 4=Atropin : II
   */
  ecgType: number,
  /** 实际导联名称 */
  leadNames: string[],
  /** 导联数 */
  leadCount: number,
  /** 姓名/心电图号/医院名称 */
  patInfo: string[],
  /** 性别
   * 1=男
   * 2=女
   */
  sex: number,
  /** 年龄值   */
  ageValue: number,
  /** 年龄单位 */
  ageUnit: string,
  data: any,
  /** 单通道数据长度 */
  dataLength: number,
}

export declare type XYTupple = {
  x: number;
  y: number;
}
